home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr28 / mxmnu239.zip / QUICK.MNU < prev    next >
Text File  |  1993-03-22  |  9KB  |  400 lines

  1. Comment
  2. ==========================================================
  3.  
  4. Copyright 1990-92 by Marc Perkel * All right reserved.
  5.  
  6. This file is a quick menu system for you to get going with MarxMenu
  7. quickly and esilly. It is written not only to be useful to us but to be
  8. an example of what can be done with MarxMenu.
  9.  
  10. To add a choice to a menu simply use the AddChoice command
  11. then add the appropiate Onkey statement.
  12. The menu will make the size adjustments accordinaly.
  13.  
  14.   Example:
  15.       AddChoice("Print Console",10)
  16.       ...
  17.       ...
  18.       OnKey Task(10)
  19.         PConsole
  20.       ...
  21.  
  22. If you want to change the menu's center, pass the XY
  23. coordinates to menu's CenterStretchBox procedure.
  24.  
  25.    Example:
  26.       CenterStretchBox("Menu Header",40,12)
  27.  
  28. This will cause the menu to center at Col 40, Row 12
  29.  
  30. Instead of defining the center of the box, there is a command
  31. CornerStretchBox where the box grows down and right.
  32.  
  33.    Example:
  34.       CornerStretchBox("Menu Header",8,6)
  35.  
  36. To control custom features, edit CUSTOM.INC and other INCLUDE Files.
  37.  
  38. =========================================================
  39. EndComment
  40.  
  41. Var
  42.   FilePicked
  43.  
  44. ;----- Personalize Your Screen Messages
  45.  
  46. StatusLineText = '*-<< Acme Manufacturing Company >>-*'
  47. MenuTitle = "Joe Blow's Master Menu"
  48.  
  49. Comment
  50. =================================
  51.  
  52. In order to add menu choices conditionally you would append the
  53. choices to the end of the array after all the default choices
  54. are set. For Example:
  55.  
  56.    if DayOfWeek = Fri
  57.       AddChoice("Payroll Menu",10)
  58.    endif
  59.  
  60. Here is where menus are created.
  61.  
  62. =================================
  63. EndComment
  64.  
  65. ;----- Menu look and feel include files
  66.  
  67. Include 'CUSTOM.INC'
  68.  
  69. Comment
  70. ==========================================================
  71.  
  72. I have defined a couple of procedures called CenterStretchBox
  73. CornerStretchBox which takes as parameters a menu title, array of
  74. choices, and the XY coordinants of the center of the window. It then
  75. displays all the choices and numbers them. This method allows you to
  76. update the menu more quickly.
  77.  
  78. ==========================================================
  79. EndComment
  80.  
  81. ;----- Main Menu
  82.  
  83. AddChoice('Accounting',1)
  84. AddChoice('Word Processing',2)
  85. AddChoice('SpreadSheet',3)
  86. AddChoice('DataBase',4)
  87. AddChoice('Graphics',5)
  88. AddChoice('Communication',6)
  89. AddChoice('Publishing',7)
  90. AddChoice('Utilities',8)
  91.  
  92. CornerStretchBox ('Main Menu',11,6)
  93.  
  94. OnKey Task(1)
  95.    |Error('Put Code for Accounting here.')
  96.  
  97. OnKey Task(2)
  98.    |Error('Put Code for Word Processing here.')
  99.  
  100. OnKey Task(3)
  101.    |Error('Put Code for SpreadSheet here.')
  102.  
  103. OnKey Task(4)
  104.    |Error('Put Code for DataBase here.')
  105.  
  106. OnKey Task(5)
  107.    |Error('Put Code for Graphics here.')
  108.  
  109. OnKey Task(6)
  110.    |Error('Put Code for Communication here.')
  111.  
  112. OnKey Task(7)
  113.    |Error('Put Code for Publishing here.')
  114.  
  115. OnKey Task(8)
  116.    ^Util
  117.  
  118. OnKey Esc
  119.    |LeaveMenu
  120.  
  121. ;----- Util Menu
  122.  
  123. :Util
  124.  
  125. AddChoice('Format Disk Menu',1)
  126. AddChoice('Dos Menu',2)
  127. AddChoice('Dos Command Line',3)
  128. AddChoice('Menu Utilities',4)
  129.  
  130. CornerStretchBox ('Utility Menu',43,6)
  131.  
  132. OnKey Task(1)
  133.   |SelectFormat
  134.   |LastKey = ' '
  135.  
  136. OnKey Task(2)
  137.   ^Dos
  138.  
  139. OnKey Task(3)
  140.   |if ExistOnPath('DOLIST.EXE') > ''
  141.      DropTo DoList
  142.   |else
  143.   |  Bat 'DropTo ' + ReadEnv('COMSPEC')
  144.   |endif
  145.  
  146. OnKey Task(4)
  147.   ^MenuUtil
  148.  
  149. ;----- Dos Menu
  150.  
  151. :Dos
  152.  
  153. AddChoice('Directory Master',1)
  154. AddChoice('Pick Directory',2)
  155. AddChoice('Memory Map',3)
  156. AddChoice('Free Space',4)
  157. AddChoice('Device Drivers',5)
  158. AddChoice('Show Directory',6)
  159. AddChoice('Backup Hard Disk',7)
  160. AddChoice('Run a Program',8)
  161.  
  162. CenterStretchBox ('DOS Menu',38,15)
  163.  
  164. OnKey Task(1)
  165.   |if ExistOnPath('DM3.EXE') > ''
  166.      DropTo DM3
  167.   |else
  168.      DropTo DM
  169.   |endif
  170.  
  171. OnKey Task(2)
  172.    PD
  173.  
  174. OnKey Task(3)
  175.    RamMap
  176.    Pause
  177.  
  178. OnKey Task(4)
  179.    Free
  180.    Pause
  181.  
  182. OnKey Task(5)
  183.    Device
  184.    Pause
  185.  
  186. OnKey Task(6)
  187.    D/W
  188.  
  189. OnKey Task(7)
  190.    CD\
  191.    BACKUP C: A: /S
  192.    |Bat 'CD ' + Path
  193.  
  194. OnKey Task(8)
  195.    |FilePicked = ProgType
  196.    |if FilePicked > ''
  197.    |   FilePicked = PickAFile(FilePicked,FilePicked + ' Files')
  198.    |   if FilePicked > ''
  199.    |      Bat FilePicked
  200.    |   endif
  201.    |endif
  202.  
  203. ;----- Menu Utilities
  204.  
  205. :MenuUtil
  206.  
  207. AddChoice('Edit this Menu',1)
  208. AddChoice('View Include Files',2)
  209. AddChoice('Edit Include Files',3)
  210. AddChoice('Veiw a Menu File',4)
  211. AddChoice('Edit a Menu File',5)
  212. AddChoice('Run a Menu',6)
  213. AddChoice('Load MarxHelp',7)
  214. AddChoice('UnLoad MarxHelp',8)
  215.  
  216. CenterStretchBox ('Menu Utilities',38,15)
  217.  
  218. OnKey Task(1)
  219.    ME %MenuFileName
  220.  
  221. OnKey Task(2)
  222.    |FilePicked = PickAFile('*.INC','Include Files')
  223.    |ViewFile(FilePicked)
  224.  
  225. OnKey Task(3)
  226.    |FilePicked = GetIncludeFile
  227.    |if FilePicked > ''
  228.    |   Bat 'ME ' + FilePicked
  229.    |endif
  230.  
  231. OnKey Task(4)
  232.    |FilePicked = PickAFile ('*.MNU','Menus')
  233.    |ViewFile(FilePicked)
  234.  
  235. OnKey Task(5)
  236.    |FilePicked = PickAFile ('*.MNU','Menus')
  237.    |if FilePicked > ''
  238.    |   Bat 'ME ' + FilePicked
  239.    |endif
  240.  
  241. OnKey Task(6)
  242.    |FilePicked = PickAFile ('*.MNU','Menus')
  243.    |if FilePicked > ''
  244.    |   Bat 'MARX ' + FilePicked
  245.    |endif
  246.  
  247. OnKey Task(7)
  248.    |MxCmd = 'MarxHelp'
  249.  
  250. OnKey Task(8)
  251.    |MxCmd = 'MarxHelp /U'
  252.  
  253. ;----- This routines selects floppy disk format
  254.  
  255. Procedure SelectFormat
  256. var Ch Message Option
  257.  
  258.    DrawTheBox(20,12,42,4 + HeightDifference,'Format Floppy Disk Menu')
  259.  
  260.    Writeln ' 1 - Format 360    5 - Format /S 360'
  261.    Writeln ' 2 - Format 1.2M   6 - Format /S 1.2M'
  262.    Writeln ' 3 - Format 720    7 - Format /S 720'
  263.    Write   ' 4 - Format 1.4M   8 - Format /S 1.4M'
  264.  
  265.    Ch = ReadKey
  266.  
  267.    if Ch = '1'
  268.       Message = '360k Format with no System Files.'
  269.       Option = '/4'
  270.  
  271.    elseif Ch = '2'
  272.       Message = '1.2m Format with no System Files.'
  273.       Option = ''
  274.  
  275.    elseif Ch = '3'
  276.       Message = '720k Format with no System Files.'
  277.       Option = '/N:9/T:80'
  278.  
  279.    elseif Ch = '4'
  280.       Message = '1.4m Format with no System Files.'
  281.       Option = '/N:18/T:80'
  282.  
  283.    elseif Ch = '5'
  284.       Message = '360k Format with System Files.'
  285.       Option = '/4/S'
  286.  
  287.    elseif Ch = '6'
  288.       Message = '1.2m Format with System Files.'
  289.       Option = '/S'
  290.  
  291.    elseif Ch = '7'
  292.       Message = '720k Format with System Files.'
  293.       Option = '/N:9/T:80/S'
  294.  
  295.    elseif Ch = '8'
  296.       Message = '1.4m Format with System Files.'
  297.       Option = '/N:18/T:80/S'
  298.  
  299.    else
  300.       Return
  301.  
  302.    endif
  303.  
  304.    if DosVersionString >= '5.00'
  305.       Option = Option + '/U'     ;unconditional
  306.       Option = Option + '/V:DOS' ;automatically adds volume label
  307.    endif
  308.  
  309.    DrawTheBox(46,18,11,2 + HeightDifference,'Drive')
  310.    Writeln '  A:'
  311.    Write   '  B:'
  312.    Ch = ReadKey
  313.    if Ch = Esc then Return
  314.    ExecFormat(Ch,Option,Message)
  315. EndProc
  316.  
  317. ;----- Execute FORMAT in a DOS Window
  318.  
  319. Procedure ExecFormat (Drv,Option,Message)
  320. var FormatProg
  321.  
  322.    FormatProg = ExistOnPath('FORMAT.EXE')
  323.    if FormatProg = '' then FormatProg = ExistOnPath('FORMAT.COM')
  324.    if FormatProg = ''
  325.       Error('FORMAT program not Found!')
  326.       Return
  327.    endif
  328.  
  329.    BoxHeader = ' Formatting Drive ' + Drv + ': ' + Message + ' '
  330.    Shadow Off
  331.    DrawBox 1 4 80 21
  332.    Window  4 5 74 19
  333.    TextColor MenuHeaderFG MenuBG
  334.    Cursor Off
  335.    DosWindow
  336.    Writeln
  337.    Execute FormatProg + ' ' + Drv + ': ' + Option
  338.    EraseTopWindow
  339. EndProc
  340.  
  341. ;----- Choose Program Type
  342.  
  343. Procedure ProgType
  344.  
  345.    AddChoice('COM File')
  346.    AddChoice('EXE File')
  347.    AddChoice('BAT File')
  348.  
  349.    CornerStretchBox ('Program Type',19,16)
  350.  
  351.    OnScreenOnly On
  352.    LastKey = ReadKey
  353.  
  354.    if LastKey = 'A' then Return '*.COM'
  355.    if LastKey = 'B' then Return '*.EXE'
  356.    if LastKey = 'C' then Return '*.BAT'
  357.    if LastKey = Esc then Return ''
  358.  
  359. EndProc
  360.  
  361. ;----- Select Include File
  362.  
  363. Procedure GetIncludeFile
  364. var IncPath
  365.    IncPath = PathPart(ExistOnPath('CUSTOM.INC'))
  366.    IncPath = PickAFile(CleanFileName(IncPath + '\*.INC'),'Include Files')
  367.    if IncPath = '' then Return ''
  368.    DelFile(ForceExtension(%MenuFileName,'MRX'))
  369.    Return IncPath
  370. EndProc
  371.  
  372.  
  373. Procedure PickAFile (Mask,Message)
  374. var Files Choice MaxSize
  375.    ReadDirectory(Mask,Files)
  376.    MaxSize = Min(15,NumberOfElements(Files))
  377.    if MaxSize = 0
  378.       Error('No Choices!')
  379.       Return ''
  380.    endif
  381.    DrawTheBox(46,12 - (MaxSize / 2),20,MaxSize + HeightDifference,Message)
  382.    Choice = PickOne(Files)
  383.    Return Choice
  384. EndProc
  385.  
  386. ;----- Display Error and Wait for a Key
  387.  
  388. Procedure Error (Err)
  389. var Ch
  390.    BoxHeader = ' Error * Press any Key '
  391.    DrawBox 11 19 Max(27,length(Err) + 4) 3
  392.    Cursor Off
  393.    UseArrows Off
  394.    TextColor MenuHeaderFG MenuBG
  395.    WriteCenter Err
  396.    Write Char(7)
  397.    Ch = ReadKey
  398.    EraseTopWindow
  399. EndProc
  400.